#include "xaudio_play.h"
#include <cstring>
#include <fstream>
#ifdef main
#undef main
#endif // !main
using namespace std;

int main(int argc, char **argv) {
  auto audio = XAudioPlay::Instance();
  XAudioSpec spec;
  spec.freq = 44100;
  audio->Open(spec);
  ifstream ifs("test_pcm.pcm", ios::binary);
  if (!ifs)
    return -1;
  unsigned char buf[1024] = {0};
  for (;;) {
    memset((char *)buf, 0, sizeof(buf));
    ifs.read((char *)buf, sizeof(buf));
    int len = ifs.gcount();
    if (len <= 0)
      break;
    audio->Push(buf, len);
  }
  getchar();
  return 0;
}
